<template>
  <div id="driver-avatar-component">
    <img :src="url" />
    <div class="text" :style="'background-color:' + textBackgroundColor + ';color:' + textColor" v-show="showText">{{text}}</div>
  </div>
</template>

<script>
export default {
  name: 'driver-avatar',
  props: {
    url: String,
    text: String,
    showText: Boolean,
    textColor: {
      type: String,
      default: '#FFFFFF'
    },
    textBackgroundColor: {
      type: String,
      default: '#6E6E6E'
    }
  }
};
</script>

<style lang="stylus" scoped>
#driver-avatar-component {
  width: 100px;
  height: 100px;

  img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }

  .text {
    font-size: 16px;
    padding: 2px 3px;
    transform: translateY(-20px);
    text-align: center;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
  }
}
</style>